package com.pic.mgt.monitor.parser;

import com.pic.mgt.monitor.WrongUnitFormatException;

public final class fileSizeParser extends FormatParser {

	@Override
	public Long parse(Object _filesizeStr) 
				throws WrongUnitFormatException {
		// 確認是否為 String 型態
		// throws WrongUnitFormatException
		super.checkObjectType(_filesizeStr, String.class);
		
		String filesizeStr = (String)_filesizeStr;
		
		Long size = null;
		try {
			size = Long.valueOf(filesizeStr);
		} catch (NumberFormatException e) {			
			throw new WrongUnitFormatException(
					"Filesize '" + filesizeStr + "' is invalid.", e);
		}
		return size;
	}

}
